#include "shellsort.h"
void shellSort(int array[], int len)
{
        int i = 0;
        int j = 0;
        int k = -1;
        int temp = -1;
        int gap = len;
        do
        {
                //业界统一实验的 平均最好的情况 经过若干次后 收敛为1
                gap = gap/3+1;
                for (i = gap; i < len; i+=gap){
                        k = i;
                        temp = array[k];
                        for (j = i-gap; (j>=0) && (array[j]>temp); j-=gap){
                                array[j+gap] = array[j];
                                k = j;
                        }
                        array[k] = temp;
                }
        } while (gap > 1);
}